package Tests;

import org.jmock.Expectations;
import org.jmock.Mockery;
import org.junit.Test;

import Core.*;
import Core.Character;

public class SnapshotApplierImplTests
{
	@Test
	public void applySnapshotIncreasesMana()
	{
		final int manaBonus = 100;
		
		Mockery context = new Mockery();
		
		final Character character = context.mock(Character.class);
		
		context.checking(new Expectations()
		{{
			ignoring(character).increaseMaxHitPoints(0.0);
			exactly(1).of(character).increaseMaxMana(manaBonus);
		}});
		
		LevelSnapshot snapshot = new LevelSnapshot();
		snapshot.setManaBonus(manaBonus);

		SnapshotApplierImpl applier = new SnapshotApplierImpl();
		
		applier.applySnapshotTo(character, snapshot);
		
		context.assertIsSatisfied();
	}
	
	@Test
	public void applySnapshotIncreasesMaxHitPoints()
	{
		final int hitPointBonus = 100;
		
		Mockery context = new Mockery();
		
		final Character character = context.mock(Character.class);
		
		context.checking(new Expectations()
		{{
			ignoring(character).increaseMaxMana(0.0);
			exactly(1).of(character).increaseMaxHitPoints(hitPointBonus);
		}});
		
		LevelSnapshot snapshot = new LevelSnapshot();
		snapshot.setHitPointBonus(hitPointBonus);

		SnapshotApplierImpl applier = new SnapshotApplierImpl();
		
		applier.applySnapshotTo(character, snapshot);
		
		context.assertIsSatisfied();		
	}
}
